
//*********************************************
//  This is Template of Cosmic Ray Generator
//                                  author:Ruiting
//

#ifndef _NuclearRecoil_H_
#define _NuclearRecoil_H_

#include "G4ThreeVector.hh"
#include "G4Types.hh"
#include "G4String.hh"
#include "G4ParticleGun.hh"
#include "MyBaseGen.hh"
#include "MyBasePos.hh"
#include "G4ParticleDefinition.hh"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#include "TFile.h"
#include "TH1D.h"
#pragma GCC diagnostic pop

#include <vector>
#include <string>
#include <memory>

class NuclearRecoil: public MyBaseGen
{
public:
    NuclearRecoil();
    ~NuclearRecoil();

    void Initialize(YAML::Node);
    void GeneratePrimaryVertex(G4Event*);
    static G4DynamicParticle HadronNuclearScattering(G4DynamicParticle&, G4int, G4int);
    static G4double SampleInvariantT(G4double, G4int);
    inline G4bool IfNeedPolPhot(){return false;}

private:
    G4ParticleGun* m_Gun;
    MyBasePos* m_PosGen;
    
    G4ParticleDefinition* m_NeutronPD;
    G4ParticleDefinition* m_IonPD;

    G4int m_Z;
    G4int m_A;
    G4int m_Charge;

    TFile* m_FileEkin;
    TH1D* m_HistEkin;

};

#endif